package 数的范围;

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int q = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        int[] res = new int[2];
        while (q-- > 0) {
            int x = in.nextInt();
            int l = 0, r = n - 1;
            //先查找区间左端点
            while (l < r) {
                int mid = l + r >> 1;
                if (arr[mid] >= x) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
            res[0] = l;
            //不存在直接返回（-1，-1）
            if (arr[l] != x) {
                System.out.println(-1 + " " + -1);
            } else {
                //存在则继续查找区间右端点
                l = 0;
                r = n - 1;
                while (l < r) {
                    int mid = l + r + 1 >> 1;
                    if (arr[mid] <= x) {
                        l = mid;
                    } else {
                        r = mid - 1;
                    }
                }
                res[1] = l;
                System.out.println(res[0] + " " + res[1]);
            }
        }
    }
}
